<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


class RecordationAndTransferTaxCreator{
    
    public static function createSplitRecordationAndTransferTaxes($state, $propertyTransferTax, $countyPropertyTransferTax, $recordationTax, $extraBuyerRecordationTax,
                                                                                $fees, $requestedPayer, $payerSpecialCase) {        

        // all recording fees will be charged to the buyer unless the user selects "Seller Pays All" then you will show the fees on the seller's side.
        // To put this another way, the default will always be that the recording fees will be to shown on the buyer's side. 

        $recordationAndTransferTaxFactory = null;
        //echo $requestedPayer; exit();
        switch ($requestedPayer) {
            case ERequestedPayer::Buyer:
                //echo "ok"; exit();
                $recordationAndTransferTaxFactory = new BuyerRecordationAndTransferTaxFactory();
                break;
            case ERequestedPayer::Seller:
                $recordationAndTransferTaxFactory = new SellerRecordationAndTransferTaxFactory();
                break;
            case ERequestedPayer::Split50:
                $recordationAndTransferTaxFactory = new Split50RecordationAndTransferTaxFactory();
                break;
            case ERequestedPayer::All:
                if ($state == EState::VA) {
                    $recordationAndTransferTaxFactory = new VADefaultRecordationAndTransferTaxFactory();
                } else if ($state == EState::MD || $state == EState::DC || $state == EState::DE) {
                    // In Maryland the default would be 50/50 - except in the scenario I explained in my prior email
                    // In dc - the custom is 50/50 - as well.
                    // DE = Default split is 50/50 - split between buyer and seller
                    //echo "ok"; exit();
                    $recordationAndTransferTaxFactory = new Split50RecordationAndTransferTaxFactory();
                } else if ($state == EState::FL) {
                    // FL rules:
                    // the default for florida is for the seller to pay taxes on documentary stamp tax on deeds.
                    // you will charge the doc stamp tax on mortgages at .35/$100 plus .002/$1.00 on the loan amount. the default is for the buyer to pay this tax.
                    $recordationAndTransferTaxFactory = new FLDefaultRecordationAndTransferTaxFactory();
                }
        }
        
        return $recordationAndTransferTaxFactory->createSplitRecordationAndTransferTaxes(
                $propertyTransferTax,
                $countyPropertyTransferTax,
                $recordationTax,
                $extraBuyerRecordationTax,
                $fees,
                $payerSpecialCase);
    }
}
?>
